package com.zzb.framework.init;

import com.zzb.framework.modules.job.service.ScheduleJobService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Component
@Order(value = 2)
@Slf4j
public class ScheduleInit  implements CommandLineRunner {
    @Value("${framework-core.schedule-open:true}")
    private Boolean openFrameworkCoreSchedule;
    @Autowired
    private ScheduleJobService scheduleJobService;
    @Override public void run(String... args) throws Exception {
        if(openFrameworkCoreSchedule) {
            log.info("schedule init");
            scheduleJobService.init();
        }
    }
}
